#pragma once

namespace test
{
   struct test_context_t
   {
      test_context_t(std::string const file_name)
         :  test_log_(std::ofstream("test_log.txt"))  
      {
         graph::global::get_instance().load_graph(file_name, std::cout);
         fast_rasterized_graph_ = graph::details::graph_metadata_ptr_t(
            new graph::details::graph_metadata_t(graph::global::get_instance().graph_.get(), true)
         );
         vector_rasterized_graph_ = graph::details::graph_metadata_ptr_t(
            new graph::details::graph_metadata_t(graph::global::get_instance().graph_.get(), false)
         );
      }
      
      ~test_context_t()
      {
         test_log_.flush();
         test_log_.close();
         std::cout << "You will find test output in test_log.txt" << std::endl;
      }
      
      std::ostream& get_test_log()
      {
         //return std::cout;
         return test_log_;
      }
      
      graph::details::graph_metadata_t const & get_fast_rasterized_graph() const
      {
         return *fast_rasterized_graph_;
      }
      
      graph::details::graph_metadata_t const & get_vector_rasterized_graph() const
      {
         return *vector_rasterized_graph_;
      }
      
private:
      std::ofstream test_log_;      
      graph::details::graph_metadata_ptr_t fast_rasterized_graph_;
      graph::details::graph_metadata_ptr_t vector_rasterized_graph_;
   };
   
}